package com.tdkj.action.backstage.decorate;

import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.decorate.BeanDecorateCustom;
import com.tdkj.service.decorate.IBeanDecorateCustomService;


public class DecorateCustomAction extends BaseAction {
    
	private IBeanDecorateCustomService decorateCustomService;
	
	private List<BeanDecorateCustom> customs ;
	
	private BeanDecorateCustom custom ;
	
	
	public String execute() {
		customs = decorateCustomService.findAll(BeanDecorateCustom.class);
		return "success";
	}
	
	public String add() {
		decorateCustomService.save(custom);
		return execute();
	}
	
	public String update() {
		decorateCustomService.saveOrUpdate(custom, BeanDecorateCustom.class);
		return execute();
	}

	public String delete() {
		decorateCustomService.delete(custom.getId(), BeanDecorateCustom.class);
		return execute();
	}
	
	public String edit() {
		custom = decorateCustomService.findById(custom.getId(), BeanDecorateCustom.class);
		return "edit";
	}

	public List<BeanDecorateCustom> getCustoms() {
		return customs;
	}

	public void setCustoms(List<BeanDecorateCustom> customs) {
		this.customs = customs;
	}

	public BeanDecorateCustom getCustom() {
		return custom;
	}

	public void setCustom(BeanDecorateCustom custom) {
		this.custom = custom;
	}

	@Resource
	public void setDecorateCustomService(
			IBeanDecorateCustomService decorateCustomService) {
		this.decorateCustomService = decorateCustomService;
	}
	
}
